<!-- -->
<script setup lang="ts">
	// defineProps 定义父到子的数据
	// withDefaults 设置默认值
	const sectionProps = withDefaults(
		defineProps<{
			// 类型
			title: string
			showArrow: boolean
		}>(),
		{
			// 默认值
			title: '默认标题哦',
			showArrow: false,
		}
	)
</script>

<template>
	<view class="custom-section">
		<view class="custom-section-header">
			<view class="section-header-title">{{ title }}</view>
			<view class="section-header-right">
				<!-- slot 传递的是 结构
				    鸿蒙中 BuilderParam
				 -->
				<slot name="right"></slot>
				<uni-icons v-if="showArrow" color="#c3c3c5" size="16" type="forward" />
			</view>
		</view>
		<slot />
	</view>
</template>

<style lang="scss">
	.custom-section {
		padding: 40rpx 30rpx 30rpx;
		margin-bottom: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
	}

	.custom-section-header {
		display: flex;
		justify-content: space-between;
		line-height: 1;
		margin-bottom: 20rpx;
	}

	.section-header-title {
		font-size: 32rpx;
		color: #333;
	}

	.section-header-right {
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #c3c3c5;
	}
</style>
